import request from '@/utils/request'

export default {
  // 获取list
  listPage(page, limit, searchObj) {
    return request.service({
      url: `/crawler/person/listPage/${page}/${limit}`,
      method: 'post',
      data: searchObj
    })
  },

  // 获取爬虫负责人list
  getManagerList() {
    return request.service({
      url: `/crawler/person/getManagerList`,
      method: 'get'
    })
  },

  // 获取队列状态list
  getQueueStatusList() {
    return request.service({
      url: `/crawler/person/getQueueStatusList`,
      method: 'get'
    })
  },

  // 获取运行状态list
  getRunStatusList() {
    return request.service({
      url: `/crawler/person/getRunStatusList`,
      method: 'get'
    })
  },

  // 获取日志状态list
  getLogStatusList() {
    return request.service({
      url: `/crawler/person/getLogStatusList`,
      method: 'get'
    })
  },

  // 获取list
  configListPage(page, limit, searchObj) {
    return request.service({
      url: `/crawler/person/configListPage/${page}/${limit}`,
      method: 'post',
      data: searchObj
    })
  },

  // 获取爬虫负责人list
  getConfigManagerList() {
    return request.service({
      url: `/crawler/person/getConfigManagerList`,
      method: 'get'
    })
  },

  // 根据id获取人员爬虫配置信息
  getConfigById(id) {
    return request.service({
      url: `/crawler/person/getConfigById/${id}`,
      method: 'get'
    })
  },

  // 更新配置信息
  updateById(detailObj) {
    return request.service({
      url: `/crawler/person/updateById`,
      method: 'post',
      data: detailObj
    })
  },

  // 新增配置信息
  addData(detailObj) {
    return request.service({
      url: `/crawler/person/addData`,
      method: 'post',
      data: detailObj
    })
  },

  foreverRemove(id, showId) {
    return request.service({
      url: `/crawler/person/foreverRemove`,
      method: 'get',
      params: {
        id,
        showId
      }
    })
  },

  // 绑定定时任务
  updateScheduledName(scheduledName) {
    return request.service({
      url: `/crawler/person/updateScheduledName`,
      method: 'get',
      params: {
        scheduledName
      }
    })
  },

  // 下载日志文件
  downloadLog(logPath) {
    return request.service({
      url: `/crawler/person/downloadLog`,
      method: 'get',
      params: {
        logPath
      }
    })
  },

  // 修改备注
  updateRemarks(id, remarks) {
    return request.service({
      url: `/crawler/person/updateRemarks`,
      method: 'get',
      params: {
        id,
        remarks
      }
    })
  }
}
